home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
taropyon
/
zmodem
/
src
/
rsctrl.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-30
|
4KB
|
156 lines
#ifndef _RSCTRL_H
#define _RSCTRL_H
#define _RS_N10
/*#define _LIBL11*/
/*#define _RS_FMC*/
#ifdef _RS_FMC
# include <fmcfrb.h>
#else
# include <rs.h>
#endif
#ifdef _RSCTRL_MAIN
# define EXT
#else
# define EXT extern
#endif
#define RS_TIMEOUT_LIMIT (0xFFFF)
#define RS_PORTNUM (5)
#ifdef _RS_FMC
typedef RSB_PARA RSB_T;
#else
#ifdef _RS_N10
typedef struct
{
unsigned char mode; /* 通信モード */
unsigned char baud; /* ボーレート */
char *rbuf; /* 受信バッファアドレス */
unsigned short sel; /* セレクター値(0x14) */
unsigned short stime; /* 送信タイムアウト */
unsigned short rtime; /* 受信タイムアウト */
int rinfbuf; /* 受信通知アドレス */
unsigned char extmode; /* 拡張モード(0x00) */
unsigned char xon; /* XONコード(0x00) */
unsigned char xoff; /* XOFFコード(0x00) */
} RSB_T;
#endif
#ifdef _LIBL11
typedef struct
{
unsigned char mode; /* 通信モード */
unsigned char baud; /* ボーレート */
char *rbuf; /* 受信バッファアドレス */
unsigned short sel; /* セレクター値(0x14) */
unsigned short stime; /* 送信タイムアウト */
unsigned short rtime; /* 受信タイムアウト */
char *rinfofs; /* 受信通知オフセット */
unsigned short rinfsel; /* 受信通知セレクタ */
unsigned char extmode; /* 拡張モード(0x00) */
unsigned char xon; /* XONコード(0x00) */
unsigned char xoff; /* XOFFコード(0x00) */
char *sendofs; /* 受信通知オフセット */
unsigned short sendsel; /* 受信通知セレクタ */
} RSB_T;
#endif
#endif /* end of ifdef _RS_FMC */
#define RS_BUFSIZ (60*1024)
typedef struct _RSB_BUF
{ unsigned short int len;
unsigned short int cnt_1;
unsigned short int inp_buf;
unsigned short int out_buf;
char buf[RS_BUFSIZ+32];
} RSBUF_T;
typedef struct
{
RSB_T *rsb;
RSBUF_T *rsBuf;
int use;
int overFlag;
int attr;
} RSCTRL_T;
EXT RSCTRL_T RsCtrl[RS_PORTNUM]
#ifdef _RSCTRL_MAIN
=
{ { NULL, NULL, 0, 0, 0 },
{ NULL, NULL, 0, 0, 0 },
{ NULL, NULL, 0, 0, 0 },
{ NULL, NULL, 0, 0, 0 },
{ NULL, NULL, 0, 0, 0 },
}
#endif
;
#define RSATT_BP (0x80)
#define RSMD_BIT_7 (0)
#define RSMD_BIT_8 (1)
#define RSMD_PARITY (2)
#define RSMD_PARITY_ODD (0)
#define RSMD_PARITY_EVEN (4)
#define RSMD_STOPBIT_1 (0)
#define RSMD_STOPBIT_2 (8)
#define RSMD_XCTRL_OFF (0)
#define RSMD_XCTRL_ON (16)
#define RSMD_CLOCK_INT (0)
#define RSMD_CLOCK_EXT (32)
#define RSMD_EXINT (128)
#define RSBAUD_300 (0)
#define RSBAUD_600 (1)
#define RSBAUD_1200 (2)
#define RSBAUD_2400 (3)
#define RSBAUD_4800 (4)
#define RSBAUD_9600 (5)
#define RSBAUD_19200 (6)
extern int RS_reopen ( int port, int md, int bp );
extern void RS_putc ( int port, int ch);
extern void RS_puts ( int port, CONST char *s );
extern void RS_printf ( int port, CONST char *form, ... );
extern void RS_close ( int port );
extern RSB_T *RS_open ( int port );
extern int RS_chk ( int port );
extern int RS_getc ( int port );
extern void RS_breakOut( int port, int tm );
extern void RS_pause(void);
extern void RS_continue(void);
extern int RS_init(void);
extern int RS_end (void);
#ifdef _RS_FMC
# define RSB_OPEN(_port) RSB_open(_port)
# define RSB_CLOSE(_port) RSB_close(_port)
# define RSB_SETPARA(_port,_para) RSB_setpara(_port,_para)
# define RSB_CTRL(_port,_ctrl) RSB_ctrl(_port,_ctrl)
# define RSB_READ(_port,_len) RSB_read(_port,_len)
# define RSB_RECEIVE(_port,_st,_sr) RSB_receive(_port,_st,_sr)
# define RSB_BREAK(_port,_tm) RSB_break(_port,_tm)
# define RSB_INITBUF(_port) RSB_initbuf(_port)
# define RSB_DTR(_port,_sw) RSB_dtr(_port,_sw)
#else
# define RSB_OPEN(_port) RSB_Open(_port)
# define RSB_CLOSE(_port) RSB_Close(_port)
# define RSB_SETPARA(_port,_para) RSB_Setpara(_port,_para)
# define RSB_CTRL(_port,_ctrl) RSB_Ctrl(_port,_ctrl)
# define RSB_READ(_port,_len) RSB_Read(_port,_len)
# define RSB_RECEIVE(_port,_st,_sr) RSB_Receive(_port,_st,_sr)
# define RSB_BREAK(_port,_tm) RSB_Break(_port,_tm)
# define RSB_INITBUF(_port) RSB_Initbuf(_port)
# define RSB_DTR(_port,_sw) RSB_Dtr(_port,_sw)
#endif
#undef EXT
#endif